﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="KinectSensorExtensions.cs" company="arvystate.net">
//   arvystate.net
// </copyright>
// <summary>
//   The kinect sensor extensions.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace PresentationAid.Core
{
    using System;

    using Microsoft.Kinect;

    /// <summary>
    /// The kinect sensor extensions.
    /// </summary>
    public static class KinectSensorExtensions
    {
        #region Public Methods and Operators

        /// <summary>
        /// The is windows kinect.
        /// </summary>
        /// <param name="kinect">
        /// The kinect.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public static bool IsWindowsKinect(this KinectSensor kinect)
        {
            try
            {
                // Testing the Kinect Sensor with forcing infrared emitter off, which
                // only Windows Sensor can do.
                kinect.ForceInfraredEmitterOff = true;
                kinect.ForceInfraredEmitterOff = false;

                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        #endregion
    }
}